Skip to content

Conversation

@evanliu048
Copy link
Contributor

@evanliu048 evanliu048 commented May 2, 2025

*Issue #, if available:*
#1422

Description of changes:
This PR enhances the /context show command by embedding associated hooks (both global and profile) under their respective sections and displaying a conversation summary for. Improves clarity and user experience.

Screen.Recording.2025-05-05.at.1.56.39.PM.mov

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@evanliu048 evanliu048 requested a review from a team May 2, 2025 00:35
@evanliu048 evanliu048 marked this pull request as draft May 2, 2025 00:35
@codecov-commenter
Copy link

codecov-commenter commented May 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 16.75%. Comparing base (dd39398) to head (b687a1f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1477   +/-   ##
=======================================
  Coverage   16.75%   16.75%           
=======================================
  Files         213      213           
  Lines       20704    20704           
  Branches      871      871           
=======================================
  Hits         3468     3468           
  Misses      17236    17236           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@evanliu048 evanliu048 changed the title feat: Include /context hooks and conversation summary in /context show feat: Include /context hooks and conversation summary in /context show --expand May 2, 2025
@evanliu048 evanliu048 marked this pull request as ready for review May 5, 2025 18:13
}

// Prints hook configuration grouped by trigger: conversation sesiion start or per user message
fn print_hook_section(output: &mut impl Write, hooks: &HashMap<String, Hook>, trigger: HookTrigger) -> Result<()> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should take a &mut self receiver instead, otherwise let's place it as a standalone function rather than an associated function

Also for doc comments, use /// instead of //

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion! 🙏
You're right — since the method doesn't use any fields from self, I've moved it out as a standalone function and updated the doc comment to use ///.

style::Print("\n\n")
)?;
} else {
self.compact_history(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely don't do this - just check if there is a summary cached, and if so print it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌I’ve updated the code to check for a cached summary and print it if present, avoiding unnecessary regeneration.

// Show last cached conversation summary if available, otherwise regenerate it
if expand {
if let Some(summary) =
self.conversation_state.latest_summary().map(|s| s.to_owned())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is inside the else block of if global_context_files.is_empty() && profile_context_files.is_empty() {, so it won't ever get executed if both global and profile context matches nothing.

Also shouldn't be necessary to to_owned here, we should be able to just print a reference

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes total sense. Moved the logic out of the else block and ditched the unnecessary .to_owned(). Learned something new again — thanks for the sharp eyes!

@evanliu048 evanliu048 requested a review from brandonskiser May 9, 2025 00:35
execute!(self.output, style::Print("\n"))?;
}

// Show last cached conversation summary if available, otherwise regenerate it
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - remove the "regenerate it" comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure will remove this comment in future pr

@brandonskiser brandonskiser merged commit b25b172 into main May 9, 2025
10 checks passed
@brandonskiser brandonskiser deleted the evanAddContext branch May 9, 2025 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants